package com.binarycat.dynamiclimit.collector;

import javax.servlet.http.HttpServletRequest;

import com.binarycat.dynamiclimit.DynamicLimiterManager;

/**
 * 抽象的限流信息收集器
 * 
 * @author jjb
 * @date 2018/08/06
 */
public abstract class AbstractLimitDataCollector {

    /**
     * 收集方法执行前的相关信息(比如qps等)
     * 
     * @param handler
     * @param request
     * @param dynamicLimiterManager
     */
    public abstract void preCollectMethodExecutionInformation(HttpServletRequest request, Object handler,
        DynamicLimiterManager dynamicLimiterManager);

    /**
     * 收集方法执行后的相关信息(比如耗费时间,异常率等)
     * 
     * @param handler
     * @param request
     * @param ex
     * @param dynamicLimiterManager
     */
    public abstract void postCollectMethodExecutionInformation(HttpServletRequest request, Object handler, Exception ex,
        DynamicLimiterManager dynamicLimiterManager);

    /**
     * 收集系统运行时信息(比如:内存使用率)
     * 
     * @param dynamicLimiterManager
     */
    public abstract void collectSystemRuntimeInfo(DynamicLimiterManager dynamicLimiterManager);

}
